﻿using System;
using System.Collections.Generic;
using System.Data;
using VeMayBayDTO;

namespace VeMayBayDAO
{
    public  class KhachHangDAO
    {

        public static DataTable TimKiemKhachHang(KhachHangDTO kh)
        {
            string query = @"select* from khachhang where cmnd = '" + kh.CMND + "'";
            DataTable dt = new DataTable();
            dt = DataProvider.ExecQuery(query);
           
            return dt;
        }
        public static bool ThemKhachHang(KhachHangDTO kh)
        {
            string query = @"insert into KhachHang (tenKhachHang,cmnd,diachi,dienthoai) 
                        values ('" + kh.TenKhachHang + "','" + kh.CMND + "','" + kh.DiaChi + "','" + kh.DienThoai + "')";
           
            int n = DataProvider.ExecNonQuery(query);
            if (n == 0)
                return false;
            return true;
        }
        public static bool CapNhat(KhachHangDTO kh)
        {
            return true;
        }
    }
}
